#ifndef TEST_NODE_H
#define TEST_NODE_H

#include "TESTS/utilities_for_tests.h"

#include "FEM/node.h"

bool nodeTest1()
{
    Node2D a(0.0,5.0);
    message((char*)"nodeTest1 a",a.coord[1] == 5.0);
    Node<5> a5(0.0,1.0,2.0,3.0,-4.0);
    return message((char*)"nodeTest1 b",a5.coord[4] == -4);
}
bool nodeTest2()
{
    Node2D *b = new Node2D();
    double *tmp_ptr = b->coord;
    b->coord[0] = 22.0;
    b->coord[1] = 33.0;
    delete b;
    return message((char*)"nodeTest2",tmp_ptr[0]!=22.0 );
}
bool nodeTest3()
{
    Node2D a(0.0,3.0);
    message((char*)"nodeTest3 a",a.coord[0] == 0.0 );
    Node2D b(4.0,0.0);
    message((char*)"nodeTest3 b",a.distanceSquare(b) == b.distanceSquare(a) &&
            a.distanceSquare(b) == 25.0 );
    b.normalize();
    message((char*)"nodeTest3 c",b.distanceSquare(Node2D(0.0,0.0)) == 1.0
                   && b.coord[0] == 1.0);
    Vector2D g(1.0,5.0);
    Vector2D k(g);
    message((char*)"nodeTest3 d",k.dotProduct(a) == 15.0);

    Vector3D a1(1.0,0.0,0.0);
    Vector3D a2(0.0,1.0,0.0);
    Vector3D *cross = a1.crossProduct(a2);
    double z = cross->coord[2];
    delete cross;
    return message((char*)"nodeTest3 e",z == 1.0);
}

#endif // TEST_NODE_H
